﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;




namespace AnalyticsConsoleApp
{
    
    class Program
    {
        static public string[] loadprofanitywords()
        {

            string[] words = { "add", "package", "changed" };
            return words;



        }

        static public string[] extractwords(string sen)
        {
            int i = 0;
            string[] str = new string[1000];
            int index1=0;
            int index2 ;
            Console.WriteLine("extracting: {0}", sen);
            
            

                
                index1 = sen.IndexOf(" ", index1);
                if (index1 != -1)
                {
                    if(index1 != 0)
                    {
                        index1 = 0;
                    }
                    while (index1 < sen.Length)
                    {

                        if (sen[index1] == ' ')
                        {
                            index1++;
                        }
                        else
                        {

                            index2 = sen.IndexOf(" ", index1);
                            if (index2 == -1)
                            {
                                index2 = sen.Length;
                            }
                            int count = index2 - index1;
                            string w = sen.Substring(index1, count);
                            

                            str[i] = w;
                            i++;
                            Console.WriteLine("{0} word found  : {1}", i, w);
                            index1 = index2 + 1;

                        }
                    }



                }
                else
                {
                    str[i] = sen;
                }
                   
                
                
            
            
            return str;
            
        }

        
        static void Main(string[] args)
        {
            int[] marks = new int[5]  {1,2,3,4,5};
            int[] score = (int[]) marks.Clone();
            score[4] = 99;
            Console.WriteLine("output is {0}", marks[4]);
            int i =10 ;
            int j = i;
            j = 12;
            float f = 1000000000000;
            int x;
            x =(int) f;
            Console.WriteLine(x);
           // string email = "A theme or skin add-on is a preset package containing additional or changed graphical appearance details, achieved by the use of a graphical user interface (GUI) that can be applied to specific software and websites to suit the purpose, topic, or tastes of different users to customize the look and feel of a piece of computer software or an operating system front-end GUI ";
            string email = "A theme or skin add-on";
            
            string[] words = loadprofanitywords();
           string[] ew= extractwords(email);
           ew = extractwords("    "); 
           ew = extractwords("abcd");
           ew = extractwords("  xxyy");
           ew = extractwords("aa         cc");
           ew = extractwords("aa   cc  ");


            
            
            char[] alpha = { 'a', 'k' };
            int ret= email.IndexOfAny(alpha);

            Console.WriteLine("the result is {0}", ret);
            Console.WriteLine("------------------------");
            ret = email.IndexOf("or");
            Console.WriteLine("the position is {0}", ret);
            Console.WriteLine("------------------------");

            for (i = 0; i < words.Length ;i++ )
            {
                
                ret = email.IndexOf(words[i]);
                Console.WriteLine("the result is {0}", words[i]);
                Console.WriteLine("the position is {0}", ret);

            }

                Console.ReadKey();
            

            
        }
    }
}
